<template>
	<view>
		<view class="n1" v-for="item in news" :key="item.id">
			<image :src="'http://124.93.196.45:10001'+item.cover"></image>
			<view class="n2">
				<text>{{item.title}}</text>
			</view>
			<view class="n3">
				<text>{{item.content}}</text>
			</view>
			<view class="n4">
				<text>评论：{{item.commentNum}}</text>
				<text>发布时间：{{item.publishDate}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				news:[]
			}
		},
		onLoad() {
			this.getallnews()
		},
		methods: {
			getallnews(){
				this.api.get('/prod-api/press/press/list').then(res=>{
					this.news=res.data.rows
				})
			}
		}
	}
</script>

<style lang="scss">
	.n1{
		line-height: 30px;
		margin-top: 20px;
		image{
			width: 100%;
			height: 200px;
		}
	}
	.n2,.n3{
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.n4{
		margin-top: 10px;
		display: flex;
		justify-content: space-between;
	}
</style>
